﻿@model PSU.Model.Areas.Administrator.Dormitory.InformationEditViewModel
@using PSU.Model.Areas
@{
    Layout = null;
    ViewData["Title"] = "寝室信息";
    ViewData["NavTitle"] = "宿舍信息管理";
    ViewData["CurrName"] = "寝室信息维护";
}

<div class="row">
    <div class="col-md-12">
        <form method="post" class="form-horizontal" role="form">
            <div class="form-group">
                <label class="col-md-2 col-xs-3 control-label no-padding-right" for="edit_name">
                    <span class="required-label">*</span>宿舍号
                </label>
                <div class="col-md-4 col-xs-9">
                    <input class="col-md-5 col-xs-12 form-control" id="edit_name" type="text" maxlength="20" asp-for="Name">
                </div>
                <label class="col-md-2 col-xs-3 control-label no-padding-right" for="edit_building"> 所属宿舍楼 </label>
                <div class="col-md-4 col-xs-9">
                    <select id="edit_building" class="form-control" asp-for="BuildingId">
                        <option value="-1">请选择</option>
                        @if (Model.BuildingList != null && Model.BuildingList.Any())
                        {
                            foreach (var item in Model.BuildingList.AsReadOnly())
                            {
                                if (item.Id == Model.BuildingId)
                                {
                                    <option value="@item.Id" selected> @item.Name </option>
                                }
                                else
                                {
                                    <option value="@item.Id"> @item.Name </option>
                                }
                            }
                        }
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label no-padding-right" for="edit_floor"> 所在楼层 </label>
                <div class="col-md-2">
                    <input class="form-control" id="edit_floor" type="number" min="1" asp-for="Floor">
                </div>
                <label class="control-label" for="edit_floor">层</label>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label no-padding-right" for="edit_bunk"> 宿舍类型 </label>
                <div class="col-md-4">
                    <select id="edit_bunk" class="form-control" asp-for="BunkId">
                        <option value="-1">请选择</option>
                        @if (Model.BunkList != null && Model.BunkList.Any())
                        {
                            foreach (var item in Model.BunkList.AsReadOnly())
                            {
                                if (item.Id == Model.BunkId)
                                {
                                    <option value="@item.Id" data_count="@item.Count" selected> @item.Name </option>
                                }
                                else
                                {
                                    <option value="@item.Id" data_count="@item.Count"> @item.Name </option>
                                }
                            }
                        }
                    </select>
                </div>
                <label class="col-md-2 control-label no-padding-right" for="edit_count"> 可容纳人数 </label>
                <div class="col-md-2">
                    <input class="form-control" id="edit_count" type="number" min="1" asp-for="Count">
                </div>
                <label class="control-label" for="floor">人</label>
            </div>
            <div class="form-group">
                <label class="col-md-2 col-xs-3 control-label no-padding-right" for="enable"> 是否启用 </label>
                <div class="col-md-4 col-xs-9">
                    <select id="enable" asp-items="@Html.GetEnumSelectList(typeof(EnumType.Enable))" class="form-control" asp-for="IsEnabled"></select>
                </div>
            </div>
            <div class="text-right">
                <a class="btn btn-success col-md-offset-2" id="save" data-id="@Model.Id">
                    <i class="fa fa-check"></i>
                    保存
                </a>
                &nbsp; &nbsp;
                <a class="btn btn-default" asp-area="Administrator" asp-controller="Dormitory" asp-action="Information">
                    <i class="fa fa-undo"></i>
                    返回
                </a>
            </div>
        </form>
    </div>
</div>